import java.io.*;
import java.security.*;
public class Skey_kb{ //显示密钥的内容，是二进制码文件
    public static void main(String args[]) throws Exception{
        FileInputStream f= null;
        try {
            f = new FileInputStream("key1.dat");
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        ObjectInputStream b=new ObjectInputStream(f);
        Key k=(Key)b.readObject( );
        byte[ ] kb=k.getEncoded( );
        FileOutputStream  f2=new FileOutputStream("keykb1.dat");
        f2.write(kb);
        // 打印密钥编码中的内容
        for(int i=0;i<kb.length;i++){
            System.out.print(kb[i]+",");
        }
    }
}
